package com.hspedu.homework;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/30
 * @time 23:47
 */
public class Homework01 {
    public static void main(String[] args) {

        try {
            if (args.length != 2){
                throw new ArrayIndexOutOfBoundsException("参数个数不正确");
            }
            double m = Integer.parseInt(args[0]);
            double n = Integer.parseInt(args[1]);

            double res = cal(m,n);
            System.out.println(res);
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println(e.getMessage());
        } catch (NumberFormatException e) {
            System.out.println("输入的格式不对，需要输入整数");
        }catch (ArithmeticException e){
            System.out.println("分母不能为0");
        }


    }

    public static double cal(double m, double n) {
        return m / n;
    }
}


